package com.jweb.framework.ws.soap.axiom;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;


import org.apache.axiom.soap.RolePlayer;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.springframework.util.ObjectUtils;
import org.springframework.ws.soap.SoapHeaderElement;
import org.springframework.ws.soap.soap11.Soap11Header;
/**
 * 修改人： Thomas
 * 修改内容：新增 
 * 类说明：
 */
public class AxiomSoap11Header extends AxiomSoapHeader implements Soap11Header {
	
	AxiomSoap11Header(SOAPHeader axiomHeader , SOAPFactory axiomFactory) {
		super(axiomHeader, axiomFactory);
	}
	
	public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(final String[] actors){
		RolePlayer rolePlayer = null ;
		if(!ObjectUtils.isEmpty(actors)){
			rolePlayer = new RolePlayer(){
				public List<?> getRoles(){
					return Arrays.asList(actors);
				}
				
				public boolean isUltimateDestination(){
					return false ;
				}
			};
		}
		
		Iterator<SOAPHeaderBlock> result = (Iterator<SOAPHeaderBlock>)getAxiomHeader().getHeadersToProcess(rolePlayer);
		return new AxiomSoapHeader.AxiomSoapHeaderElementIterator(result);
	}


}
